﻿/*----------------------------------------------------------------
// Copyright (C) 2011 王冲
// 版权所有。 
//
// 文件名：DeptManagementInfo
// 文件功能描述：部门管理
//
// 
// 创建标识：2012-04-10
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DAO.WaiGaoQiao;

namespace Model.WaiGaoQiao
{
    public class DeptManagementInfo
    {
        public int departmentid
        {
            get;
            set;
        }

        public string departmentno
        {
            get;
            set;
        }

        public string departmentname
        {
            get;
            set;
        }

        public int groupid
        {
            get;
            set;
        }

        public string groupno
        {
            get;
            set;
        }

        public string groupname
        {
            get;
            set;
        }

        public int updepartmentid
        {
            get;
            set;
        }

        private DataAccessDeptManagement deptAccess;

        /// <summary>
        /// 获取部门根节点
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public IList<DeptManagementInfo> SelDeptInfo()
        {
            deptAccess = new DataAccessDeptManagement();
            IList<DeptManagementInfo> deptlist = new List<DeptManagementInfo>();
            DeptManagementInfo deptinfo;
            DataSet ds = deptAccess.SelDeptInfo();
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                deptinfo = new DeptManagementInfo();
                deptinfo.departmentid = Convert.ToInt32(item["Dep_ID"]);
                deptinfo.departmentno = item["Dep_No"].ToString();
                deptinfo.departmentname = item["deptName"].ToString();
                deptlist.Add(deptinfo);
            }
            return deptlist;
        }

        /// <summary>
        /// 获取部门子节点
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public IList<DeptManagementInfo> SelDeptChildInfo()
        {
            deptAccess = new DataAccessDeptManagement();
            IList<DeptManagementInfo> deptlist = new List<DeptManagementInfo>();
            DeptManagementInfo deptinfo;
            DataSet ds = deptAccess.SelDeptChildInfo();
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                deptinfo = new DeptManagementInfo();
                deptinfo.groupid = Convert.ToInt32(item["groupid"]);
                deptinfo.groupno = item["groupno"].ToString();
                deptinfo.groupname = item["groupname"].ToString();
                deptinfo.updepartmentid = Convert.ToInt32(item["departmentid"]);
                deptlist.Add(deptinfo);
            }
            return deptlist;
        }
    }
}
